<template>
  <el-dialog
  class="MonitorFootEditor"
    title="修改拱脚下沉量测数据"
    :visible.sync="dialogEditorVisible"
    width="50%"
    :before-close="handleClose"
  >
    <el-form
      :inline="true"
      ref="form"
      class="demo-form-inline"
      :model="currentRow"
      label-width="120px"
    >
      <el-row>
        <el-col :span="12">
          <el-form-item label="GJ1测量值">
            <el-input v-model="currentRow.footValue"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="GJ1当日下沉值">
            <el-input v-model="currentRow.footTodaySink"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="GJ1累计下沉值">
            <el-input v-model="currentRow.footNumSink"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="GJ2测量值">
            <el-input v-model="currentRow.foot2Value"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item label="GJ2当日下沉值">
            <el-input v-model="currentRow.foot2TodaySink"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="GJ2累计下沉值">
            <el-input v-model="currentRow.foot2NumSink"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="测量时间">
            <el-date-picker
              type="date"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder="选择日期"
              v-model="currentRow.createDate"
              style="width: 100%;"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogEditorVisible = false">取 消</el-button>
      <el-button type="primary" @click="create">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import api from "../../../api";
import qs from "qs";

export default {
  data() {
    return {
      dialogEditorVisible: false,
      wId: 0,
      pageNo:1,
      currentRow: {},
    };
  },
  props: {
    flag: {
      type: Boolean,
      default: false,
    },
  },
  mounted() {
    this.$bus.$on("onShowMonitorFootEditor", (row) => {
      this.dialogEditorVisible = true;
      this.currentRow = row.data;
      this.pageNo = row.pageNo
    });
    this.$bus.$on("editorMonitorFootWid", (row) => {
      this.wId = row;
    });
  },
  methods: {
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    create() {
      if (this.wId == null) {
        this.$message({
          type: "fail",
          message: "请选择洞幅!",
        });
        return;
      }

      api
        .monitorFootUpdate(qs.stringify(this.currentRow))
        .then((res) => {
          if (res.data.code == 2001) {
            this.$message({
              type: "success",
              message: "更新成功!",
            });
            this.dialogEditorVisible = false;
            this.$bus.$emit("onRefreshmonitorFoot", {
              wId: this.form.wId,
              sId: this.form.sId,
            });
          }
        })
        .catch((err) => {});
    },
    onSubmit() {
      console.log("submit!");
    },
  },
};
</script>

<style scoped>
.avatar-uploader .el-upload {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  width: 50px !important;
  height: 50px !important;
  font-size: 28px;
  line-height: 50px !important;
  color: #8c939d;
  text-align: center;
}
.avatar {
  display: block;
  width: 50px !important;
  height: 50px !important;
}
.imgbeforepad {
  padding-top: 0px !important;
}
.avatar-uploader .el-icon-plus {
  margin: 15px !important;
}

.MonitorFootEditor :deep(.el-input--suffix .el-input__inner){
  width: 202px;
}
.MonitorFootEditor :deep(.el-textarea__inner){
  width: 202px;
}
.MonitorFootEditor :deep(.el-form--inline .el-form-item__content){
  width: 202px;
}
</style>